﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiMaterialTextureData : OdRxObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiMaterialTextureData(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGiMaterialTextureData_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiMaterialTextureData obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiMaterialTextureData()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiMaterialTextureData(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdGiMaterialTextureData cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiMaterialTextureData_cast(OdRxObject.getCPtr(pObj));
			OdGiMaterialTextureData result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiMaterialTextureData)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiMaterialTextureData)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiMaterialTextureData)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiMaterialTextureData_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiMaterialTextureData_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiMaterialTextureData_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdGiMaterialTextureData createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiMaterialTextureData_createObject();
			OdGiMaterialTextureData result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiMaterialTextureData)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiMaterialTextureData)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiMaterialTextureData)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setTextureData(OdGiMaterialTextureData.DevDataVariant pDeviceInfo, OdGiImageBGRA32 image)
		{
			GlobalsPINVOKE.OdGiMaterialTextureData_setTextureData(this.swigCPtr, OdGiMaterialTextureData.DevDataVariant.getCPtr(pDeviceInfo), OdGiImageBGRA32.getCPtr(image));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void textureData(OdGiPixelBGRA32Array data, out uint width, out uint height)
		{
			GlobalsPINVOKE.OdGiMaterialTextureData_textureData(this.swigCPtr, OdGiPixelBGRA32Array.getCPtr(data), out width, out height);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual bool haveData()
		{
			bool result = GlobalsPINVOKE.OdGiMaterialTextureData_haveData(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdGiMaterialTextureData createDefaultTextureDataImplementation()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiMaterialTextureData_createDefaultTextureDataImplementation();
			OdGiMaterialTextureData result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiMaterialTextureData)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiMaterialTextureData)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiMaterialTextureData)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdRxClass defaultTextureDataImplementationDesc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiMaterialTextureData_defaultTextureDataImplementationDesc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		public class DevDataVariant : IDisposable
		{
			[EditorBrowsable(EditorBrowsableState.Never)]
			public DevDataVariant(IntPtr cPtr, bool cMemoryOwn)
			{
				this.swigCMemOwn = cMemoryOwn;
				this.swigCPtr = new HandleRef(this, cPtr);
			}

			[EditorBrowsable(EditorBrowsableState.Never)]
			public static HandleRef getCPtr(OdGiMaterialTextureData.DevDataVariant obj)
			{
				if (obj != null)
				{
					return obj.swigCPtr;
				}
				return new HandleRef(null, IntPtr.Zero);
			}

			~DevDataVariant()
			{
				this.Dispose();
			}

			public virtual void Dispose()
			{
				if (this.swigCPtr.Handle != IntPtr.Zero)
				{
					if (this.swigCMemOwn)
					{
						lock (this.locker)
						{
							if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
							{
								this.swigCMemOwn = false;
								GlobalsPINVOKE.delete_OdGiMaterialTextureData_DevDataVariant(this.swigCPtr);
							}
						}
						this.swigCMemOwn = false;
					}
					this.swigCPtr = new HandleRef(null, IntPtr.Zero);
				}
				GC.SuppressFinalize(this);
			}

			public DevDataVariant() : this(GlobalsPINVOKE.new_OdGiMaterialTextureData_DevDataVariant__SWIG_0(), true)
			{
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}

			public DevDataVariant(IntPtr ptr) : this(GlobalsPINVOKE.new_OdGiMaterialTextureData_DevDataVariant__SWIG_1(ptr), true)
			{
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}

			public DevDataVariant(OdRxObject ptr) : this(GlobalsPINVOKE.new_OdGiMaterialTextureData_DevDataVariant__SWIG_2(OdRxObject.getCPtr(ptr)), true)
			{
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}

			public OdGiMaterialTextureData.DevDataVariant.DevDataVariantType type()
			{
				OdGiMaterialTextureData.DevDataVariant.DevDataVariantType result = (OdGiMaterialTextureData.DevDataVariant.DevDataVariantType)GlobalsPINVOKE.OdGiMaterialTextureData_DevDataVariant_type(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}

			public IntPtr getPtr()
			{
				IntPtr result = GlobalsPINVOKE.OdGiMaterialTextureData_DevDataVariant_getPtr(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}

			public OdRxObject getRxObject()
			{
				MemoryManager memoryManager = MemoryManager.GetMemoryManager();
				MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
				IntPtr p = GlobalsPINVOKE.OdGiMaterialTextureData_DevDataVariant_getRxObject(this.swigCPtr);
				OdRxObject result;
				if (currentTransaction != null)
				{
					currentTransaction.AddObject(Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
					result = Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
				}
				else
				{
					result = Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
				}
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}

			public OdGiMaterialTextureData.DevDataVariant Assign(IntPtr ptr)
			{
				OdGiMaterialTextureData.DevDataVariant result = new OdGiMaterialTextureData.DevDataVariant(GlobalsPINVOKE.OdGiMaterialTextureData_DevDataVariant_Assign__SWIG_0(this.swigCPtr, ptr), false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}

			public OdGiMaterialTextureData.DevDataVariant Assign(OdRxObject ptr)
			{
				OdGiMaterialTextureData.DevDataVariant result = new OdGiMaterialTextureData.DevDataVariant(GlobalsPINVOKE.OdGiMaterialTextureData_DevDataVariant_Assign__SWIG_1(this.swigCPtr, OdRxObject.getCPtr(ptr)), false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}

			public OdGiMaterialTextureData.DevDataVariant setPtr(IntPtr ptr)
			{
				OdGiMaterialTextureData.DevDataVariant result = new OdGiMaterialTextureData.DevDataVariant(GlobalsPINVOKE.OdGiMaterialTextureData_DevDataVariant_setPtr(this.swigCPtr, ptr), false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}

			public OdGiMaterialTextureData.DevDataVariant setRxObject(OdRxObject ptr)
			{
				OdGiMaterialTextureData.DevDataVariant result = new OdGiMaterialTextureData.DevDataVariant(GlobalsPINVOKE.OdGiMaterialTextureData_DevDataVariant_setRxObject(this.swigCPtr, OdRxObject.getCPtr(ptr)), false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}

			public void clear()
			{
				GlobalsPINVOKE.OdGiMaterialTextureData_DevDataVariant_clear(this.swigCPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}

			private object locker = new object();

			private HandleRef swigCPtr;

			protected bool swigCMemOwn;

			public enum DevDataVariantType
			{
				DevDataVariantType_Void,
				DevDataVariantType_Ptr,
				DevDataVariantType_RxObject
			}
		}
	}
}
